{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "eaed3491",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                 job_title  job_low_salary  job_high_salary  job_ave_salary  \\\n",
      "0      少儿编程讲师（python/java）      8000.00000      13000.00000     10500.00000   \n",
      "1               金融项目Java开发     10000.00000      14000.00000     12000.00000   \n",
      "2                Java中高级研发     10000.00000      15000.00000     12500.00000   \n",
      "3                     Java      6000.00000      12000.00000      9000.00000   \n",
      "4                Java大数据方向     12000.00000      24000.00000     18000.00000   \n",
      "...                    ...             ...              ...             ...   \n",
      "28157                 机器学习      3000.00000       5000.00000      4000.00000   \n",
      "28158          深度学习算法设计及优化     10000.00000      15000.00000     12500.00000   \n",
      "28159          深度学习算法设计及优化     10000.00000      15000.00000     12500.00000   \n",
      "28160                 视觉算法     12000.00000      16000.00000     14000.00000   \n",
      "28161               资深图像算法     25714.28571      42857.14286     34285.71429   \n",
      "\n",
      "      job_company    job_company_tag job_education job_experience  \\\n",
      "0            童程童美    培训机构已上市10000人以上            本科           经验不限   \n",
      "1             中科软   计算机软件已上市10000人以上            本科           1-3年   \n",
      "2            北财在线     计算机软件未融资20-99人            本科           1-3年   \n",
      "3             中科软   计算机软件已上市10000人以上            本科           1-3年   \n",
      "4            世纪高通  数据服务不需要融资100-499人            本科           经验不限   \n",
      "...           ...                ...           ...            ...   \n",
      "28157      美途国际教育      在线教育天使轮20-99人            大专           1年以内   \n",
      "28158     中星微电子集团     互联网未融资500-999人            本科           3-5年   \n",
      "28159     中星微电子集团     互联网未融资500-999人            本科           3-5年   \n",
      "28160        重庆固高      智能硬件天使轮20-99人            本科           3-5年   \n",
      "28161       某知名企业    计算机服务A轮100-499人            博士           1-3年   \n",
      "\n",
      "      company_city job_type  \n",
      "0               北京     Java  \n",
      "1               北京     Java  \n",
      "2               北京     Java  \n",
      "3               北京     Java  \n",
      "4               北京     Java  \n",
      "...            ...      ...  \n",
      "28157           重庆     人工智能  \n",
      "28158           重庆    算法工程师  \n",
      "28159           重庆     人工智能  \n",
      "28160           重庆    算法工程师  \n",
      "28161           重庆    算法工程师  \n",
      "\n",
      "[28162 rows x 10 columns]\n"
     ]
    }
   ],
   "source": [
    "#读入数据并打印\n",
    "import pandas as pd\n",
    "data = pd.read_csv(r\"C:\\Users\\QiAnge\\Desktop\\data_csv.csv\")\n",
    "print(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "8c98b343",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['上海', '北京', '南京', '天津', '广州', '成都', '杭州', '武汉', '深圳', '苏州', '西安', '重庆']\n"
     ]
    }
   ],
   "source": [
    "from pyecharts.charts.basic_charts.bar import Bar\n",
    "average_salary = data.groupby('company_city')['job_ave_salary'].mean()#平均工资\n",
    "average_low_salary = data.groupby('company_city')['job_low_salary'].mean()#最低平均工资\n",
    "average_high_salary = data.groupby('company_city')['job_high_salary'].mean()#最高平均工资\n",
    "x = average_salary.reset_index()['company_city'].tolist()\n",
    "y1 = average_salary.reset_index()['job_ave_salary'].round(2).tolist()\n",
    "y2 = average_low_salary.reset_index()['job_low_salary'].round(2).tolist()\n",
    "y3 = average_high_salary.reset_index()['job_high_salary'].round(2).tolist()\n",
    "print(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ee8bdb66",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'E:\\\\Data\\\\Jupyter\\\\中国各城市互联网行业平均工资.html'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#绘制中国各城市互联网行业平均工资的柱状图\n",
    "from pyecharts.charts import Bar\n",
    "from pyecharts import options as opts \n",
    "bar = Bar()\n",
    "bar.add_xaxis(x)\n",
    "bar.add_yaxis(\"平均工资\", y1)\n",
    "bar.set_global_opts(title_opts=opts.TitleOpts(title=\"中国各城市互联网行业平均工资\"))\n",
    "bar.render('中国各城市互联网行业平均工资.html')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "d5f7653a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'E:\\\\Data\\\\Jupyter\\\\中国各学历在互联网行业的平均工资.html'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#绘制中国各学历在互联网行业平均工资的柱状图\n",
    "job_education_average_salary = data.groupby('job_education')['job_ave_salary'].mean()#平均工资\n",
    "job_education_average_low_salary = data.groupby('job_education')['job_low_salary'].mean()#最低平均工资\n",
    "job_education_average_high_salary = data.groupby('job_education')['job_high_salary'].mean()#最高平均工资\n",
    "x = job_education_average_salary.reset_index()['job_education'].tolist()\n",
    "y1 = job_education_average_salary.reset_index()['job_ave_salary'].round(2).tolist()\n",
    "\n",
    "bar = Bar()\n",
    "bar.add_xaxis(x)\n",
    "bar.add_yaxis(\"平均工资\", y1)\n",
    "bar.set_global_opts(title_opts=opts.TitleOpts(title=\"中国各学历在互联网行业的平均工资\"))\n",
    "\n",
    "bar.render('中国各学历在互联网行业的平均工资.html')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "75912647",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'E:\\\\Data\\\\Jupyter\\\\中国互联网行业各岗位平均工资.html'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#绘制中国互联网行业各岗位平均工资的柱状图\n",
    "job_average_salary = data.groupby('job_type')['job_ave_salary'].mean()#平均工资\n",
    "job_average_low_salary = data.groupby('job_type')['job_low_salary'].mean()#最低平均工资\n",
    "job_average_high_salary = data.groupby('job_type')['job_high_salary'].mean()#最高平均工资\n",
    "x = job_average_salary.reset_index()['job_type'].tolist()\n",
    "y1 = job_average_salary.reset_index()['job_ave_salary'].round(2).tolist()\n",
    "\n",
    "bar=Bar(init_opts=opts.InitOpts(width=\"1250px\",\n",
    "                                height=\"750px\"))\n",
    "bar.add_xaxis(x)\n",
    "bar.add_yaxis(\"平均工资\", y1)\n",
    "bar.set_global_opts(title_opts=opts.TitleOpts(title=\"中国互联网行业各岗位平均工资\"))\n",
    "bar.render('中国互联网行业各岗位平均工资.html')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "b88586bf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'E:\\\\Data\\\\Jupyter\\\\中国互联网行业不同工作经验的平均工资.html'"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#绘制中国互联网行业不同工作经验的平均工资柱状图\n",
    "job_experience_average_salary = data.groupby('job_experience')['job_ave_salary'].mean()#平均工资\n",
    "job_experience_average_low_salary = data.groupby('job_experience')['job_low_salary'].mean()#最低平均工资\n",
    "job_experience_average_high_salary = data.groupby('job_experience')['job_high_salary'].mean()#最高平均工资\n",
    "x = job_experience_average_salary.reset_index()['job_experience'].tolist()\n",
    "y1 = job_experience_average_salary.reset_index()['job_ave_salary'].tolist()\n",
    "\n",
    "bar=Bar(init_opts=opts.InitOpts(width=\"1000px\",\n",
    "                                height=\"600px\"))\n",
    "bar.add_xaxis(x)\n",
    "bar.add_yaxis(\"平均工资\", y1)\n",
    "bar.set_global_opts(title_opts=opts.TitleOpts(title=\"中国互联网行业不同工作经验的平均工资\"))\n",
    "bar.render('中国互联网行业不同工作经验的平均工资.html')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "86333f85",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
